package com.hc.demo_api820.controller;

import com.hc.demo_api820.domain.Setmeal;
import com.hc.demo_api820.dto.ResultResponse;
import com.hc.demo_api820.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SetmealController {
    @Autowired
    SetmealService setmealService;
//        如果后端数据问题，跟着底层包去一层一层找，
    @RequestMapping("/listSetmeal")
//    (@PathVariable Integer type) 如果写成(@PathVariable("type") Integer type) 就用不了
    public ResultResponse listSetmeal(@RequestBody Setmeal setmeal) {
        return setmealService.listSetmeal(setmeal.getType());
    }

    @RequestMapping("/getSetmealById")
    public ResultResponse getSetmealById(@RequestBody Setmeal setmeal) {
       return setmealService.selectOneById(setmeal.getSmId());
    }



}
